package org.apache.spark.sql.execution.datasources.rest

import org.apache.spark.internal.Logging
import org.apache.spark.sql.SQLContext
import org.apache.spark.sql.sources.{BaseRelation, DataSourceRegister, RelationProvider}

class RestDataSourceProvider extends RelationProvider with DataSourceRegister with Logging {
  override def createRelation(sqlContext: SQLContext, params: Map[String, String]): BaseRelation = {
    println("params: " + params.toString())
    println("config: " + sqlContext.conf.getConfString("rest.query.url", "none"))
    new RestRelation(sqlContext.sparkSession, RestPartition.computePartition(sqlContext.sparkContext, params), params)
  }

  override def shortName(): String = "rest"
}
